<?php

use Illuminate\Support\Facades\Route;

// 因为权限验证问题所以不允许这里直接使用闭包 否则会报错； str_contains

Route::any('testC', [\App\Http\Controllers\System\TestController::class,'test']);
Route::any('test', [\App\Http\Controllers\System\TestController::class,'upload']);
Route::any('qyWxMessageCallBack', [\App\Http\Controllers\System\TestController::class,'qyWxMessageCallBack']);

Route::prefix('com')->group(function (){
    Route::get('list',[\App\Http\Controllers\Company\CompanyController::class,'getList']);
    Route::get('select',[\App\Http\Controllers\Company\CompanyController::class,'getSelect']);
    Route::get('info/{id}',[\App\Http\Controllers\Company\CompanyController::class,'getInfo']);
    Route::get('selectPage',[\App\Http\Controllers\Company\CompanyController::class,'getSelectHasPage']);
    Route::post('create',[\App\Http\Controllers\Company\CompanyController::class,'create']);
    Route::post('/update/{id}',[\App\Http\Controllers\Company\CompanyController::class,'update']);
});

Route::prefix('dept')->group(function (){
    Route::get('list',[\App\Http\Controllers\Department\DepartmentController::class,'getList']);
    Route::get('select',[\App\Http\Controllers\Department\DepartmentController::class,'getSelect']);
    Route::get('info/{id}',[\App\Http\Controllers\Department\DepartmentController::class,'getInfo']);
    Route::get('selectPage',[\App\Http\Controllers\Department\DepartmentController::class,'getSelectHasPage']);
    Route::post('create',[\App\Http\Controllers\Department\DepartmentController::class,'create']);
    Route::post('/update/{id}',[\App\Http\Controllers\Department\DepartmentController::class,'update']);
    Route::post('/fakeDelete/{id}',[\App\Http\Controllers\Department\DepartmentController::class,'fakeDelete']);
});

Route::prefix('user')->group(function (){
    Route::post('login',[\App\Http\Controllers\Login\LoginController::class,'login']);
    Route::get('uPu',[\App\Http\Controllers\Login\LoginController::class,'getUserPuKey']);
    Route::get('currentUser',[\App\Http\Controllers\User\ManageUserController::class,'getCurrentUser']);
    Route::get('list',[\App\Http\Controllers\User\ManageUserController::class,'getList']);
    Route::get('select',[\App\Http\Controllers\User\ManageUserController::class,'getSelect']);
    Route::get('info/{id}',[\App\Http\Controllers\User\ManageUserController::class,'getInfo']);
    Route::get('selectPage',[\App\Http\Controllers\User\ManageUserController::class,'getSelectHasPage']);
    Route::post('create',[\App\Http\Controllers\User\ManageUserController::class,'create']);
    Route::post('/update/{id}',[\App\Http\Controllers\User\ManageUserController::class,'update']);
    Route::post('/fakeDelete/{id}',[\App\Http\Controllers\User\ManageUserController::class,'fakeDelete']);
});

Route::prefix('client')->group(function (){
    Route::get('list',[\App\Http\Controllers\Client\ClientController::class,'getList']);
    Route::get('select',[\App\Http\Controllers\Client\ClientController::class,'getSelect']);
    Route::get('info/{id}',[\App\Http\Controllers\Client\ClientController::class,'getInfo']);
    Route::get('selectPage',[\App\Http\Controllers\Client\ClientController::class,'getSelectHasPage']);
    Route::post('create',[\App\Http\Controllers\Client\ClientController::class,'create']);
    Route::post('/update/{id}',[\App\Http\Controllers\Client\ClientController::class,'update']);
    Route::post('/fakeDelete/{id}',[\App\Http\Controllers\Client\ClientController::class,'fakeDelete']);
    Route::post('/fakeDeleteByIds',[\App\Http\Controllers\Client\ClientController::class,'fakeDeleteByIds']);
    Route::post('/bindLettersTemp/{id}',[\App\Http\Controllers\Client\ClientController::class,'bindLawCaseTemp']);
});


Route::prefix('auth')->group(function (){
    Route::get('list',[\App\Http\Controllers\Auth\AuthController::class,'getList']);
});

Route::prefix('role')->group(function (){
    Route::get('list',[\App\Http\Controllers\Role\RoleController::class,'getList']);
    Route::post('create',[\App\Http\Controllers\Role\RoleController::class,'create']);
    Route::post('bind',[\App\Http\Controllers\Role\RoleController::class,'bindUser']);
    Route::post('bindAuth',[\App\Http\Controllers\Role\RoleController::class,'bindAuth']);
});

Route::prefix('customers')->group(function (){
    Route::get('list',[\App\Http\Controllers\Customers\ManageCustomersController::class,'getList']);
    Route::get('selectPage',[\App\Http\Controllers\Customers\ManageCustomersController::class,'getSelectHasPage']);
    Route::get('info/{id}',[\App\Http\Controllers\Customers\ManageCustomersController::class,'getInfo']);
//    Route::post('disable/{id}',[\App\Http\Controllers\Customers\ManageCustomersController::class,'getInfo']);
//    Route::post('enable/{id}',[\App\Http\Controllers\Customers\ManageCustomersController::class,'getInfo']);
});


Route::prefix('sys')->group(function (){
    Route::get('dPu',[\App\Http\Controllers\System\ConfigController::class,'getConfigPuKey']);
    Route::post('upload',[\App\Http\Controllers\System\UploadController::class,'upload']);
    Route::post('download/{fileId}',[\App\Http\Controllers\System\UploadController::class,'download']);
    Route::get('chatCaptcha',[\App\Http\Controllers\System\CaptchaController::class,'getChatCaptcha']);
    // mapping
    Route::get('dataMapping',[\App\Http\Controllers\System\DataMappingController::class,'getList']);
});

Route::prefix('goods')->group(function (){
    Route::post('create',[\App\Http\Controllers\Goods\ManageGoodsController::class,'create']);
    Route::get('list',[\App\Http\Controllers\Goods\ManageGoodsController::class,'getList']);
    Route::get('info/{goods_id}',[\App\Http\Controllers\Goods\ManageGoodsController::class,'getInfo']);
    Route::post('update/{goods_id}',[\App\Http\Controllers\Goods\ManageGoodsController::class,'update']);
    Route::post('setPrice/{goods_id}',[\App\Http\Controllers\Goods\ManageGoodsController::class,'setPrice']);
    Route::post('enable/{goods_id}',[\App\Http\Controllers\Goods\ManageGoodsController::class,'enableGoods']);
    Route::post('disable/{goods_id}',[\App\Http\Controllers\Goods\ManageGoodsController::class,'disableGoods']);

    Route::post('setConfig',[\App\Http\Controllers\Goods\ManageGoodsConfigController::class,'setConfig']);
    Route::get('getConfig',[\App\Http\Controllers\Goods\ManageGoodsConfigController::class,'getConfig']);

});


// 商品类型
Route::prefix('gst')->group(function(){
    Route::post('update/{goodsTypeId}',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'update']);
    Route::post('create',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'create']);
    Route::get('list',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'getList']);
    Route::get('select',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'getSelect']);
    Route::get('selectPage',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'getSelectHasPage']);
});
